package me.jiatao.usercenter.mvp.service.impl

import io.reactivex.Observable
import me.jiatao.baselibrary.rx.convert
import me.jiatao.baselibrary.rx.convertBoolean
import me.jiatao.usercenter.data.protocol.UserInfo
import me.jiatao.usercenter.data.respository.UserRepository
import me.jiatao.usercenter.mvp.service.UserService
import javax.inject.Inject

class UserServiceImpl @Inject constructor() : UserService {

    @Inject
   lateinit var repository :UserRepository

    /**
     * 用户注册
     */
    override fun register(mobile: String, pwd: String, verifyCode: String): Observable<Boolean> {
        return repository.register(mobile, pwd, verifyCode).convertBoolean()
    }

    override fun login(mobile: String, pwd: String): Observable<UserInfo> {
        return repository.login(mobile, pwd).convert()
    }
}